/*
* @Author: wanghongfucoder
* @Date:   2017-04-12 10:09:07
* @Last Modified by:   wanghongfucoder
* @Last Modified time: 2017-04-12 10:28:07
*/

public class ServiceLocator {
	
	private static Cache cache;

	static{
		cache=new Cache();
	}

	public static Service getService(String jndName){
		Service  service=cache.getService(jndName);
		if (service!=null) {
			return service;
		}
		InitialContext context=new InitialContext();
		Service service1=(Service)context.lookup(jndName);
		cache.addService(service1);
		return service1;
	} 
}